import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '../views/body/index.vue'    //布局
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'index',
    component: index,
    redirect: '/home',
    children: [
      require('./home.js'), //首页
      require('./dataView.js'), //数据视图
      require('./richText.js'), //富文本
      require('./classify.js'), //分类
      require('./table.js'),  //表格
      require('./excel.js'),  //excel
      require('./map.js'),  //百度地图
      require('./tabs.js'), //tabs选项卡
      require('./tree.js'), //tree数据树
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/conmon/login.vue')
  }
]

const router = new VueRouter({
  scrollBehavior () {
    document.querySelector('.Main') && (document.querySelector('.Main').scrollTop = 0)
  },
  routes
})

export default router
